home *** CD-ROM | disk | FTP | other *** search
- //***********************************************************************
- //
- // Paint7.cpp
- //
- //***********************************************************************
-
- #include <afxwin.h>
- #include "Resource.h"
- #include "CLine.h"
- #include "Paint7.h"
- #include "MainFrame.h"
- #include "Paint7Doc.h"
- #include "Paint7View.h"
- #include "AboutDlg.h"
-
- CPaintApp myApp;
-
- BEGIN_MESSAGE_MAP (CPaintApp, CWinApp)
- ON_COMMAND (ID_FILE_NEW, CWinApp::OnFileNew)
- ON_COMMAND (ID_FILE_OPEN, CWinApp::OnFileOpen)
- ON_COMMAND (ID_APP_ABOUT, OnAppAbout)
- END_MESSAGE_MAP ()
-
- BOOL CPaintApp::InitInstance ()
- {
- SetRegistryKey ("Programming Windows 95 with MFC");
- LoadStdProfileSettings ();
-
- CMultiDocTemplate* pDocTemplate;
- pDocTemplate = new CMultiDocTemplate (
- IDR_CHILDFRAME,
- RUNTIME_CLASS (CPaintDoc),
- RUNTIME_CLASS (CMDIChildWnd),
- RUNTIME_CLASS (CPaintView));
-
- // Convert items in the Color menu to MF_OWNERDRAW
- if (pDocTemplate->m_hMenuShared != NULL) {
- CMenu* pMenu = CMenu::FromHandle (pDocTemplate->m_hMenuShared);
- for (int i=0; i<8; i++)
- pMenu->ModifyMenu (ID_COLOR_BLACK + i,
- MF_BYCOMMAND | MF_OWNERDRAW, ID_COLOR_BLACK + i);
- }
-
- AddDocTemplate (pDocTemplate);
-
- CMainFrame* pMainFrame = new CMainFrame;
- if (!pMainFrame->LoadFrame (IDR_MAINFRAME))
- return FALSE;
- m_pMainWnd = pMainFrame;
-
- EnableShellOpen ();
- RegisterShellFileTypes (TRUE);
- m_pMainWnd->DragAcceptFiles ();
-
- CCommandLineInfo cmdInfo;
- ParseCommandLine (cmdInfo);
-
- if (!ProcessShellCommand (cmdInfo))
- return FALSE;
-
- pMainFrame->ShowWindow (m_nCmdShow);
- pMainFrame->UpdateWindow ();
- return TRUE;
- }
-
- void CPaintApp::OnAppAbout ()
- {
- CAboutDialog dlg;
- dlg.DoModal ();
- }
-